<template>
	<div class="max">
		<my-header :backBtn="true"></my-header>
		<div class="cont-nof">
			<div class="weui-form-preview">
				<div class="weui-form-preview__hd">
					<div class="weui-form-preview__item">
						<label class="weui-form-preview__label">请假人</label>
						<em class="weui-form-preview__value">{{data.studentName}}</em>
					</div>
				</div>
				<div class="weui-form-preview__bd">
					<div class="weui-form-preview__item">
						<label class="weui-form-preview__label">请假类型</label>
						<span class="weui-form-preview__value">{{data.leaveType}}</span>
					</div>
					<div class="weui-form-preview__item">
						<label class="weui-form-preview__label">开始时间</label>
						<span class="weui-form-preview__value">{{data.startTime}}</span>
					</div>
					<div class="weui-form-preview__item">
						<label class="weui-form-preview__label">结束时间</label>
						<span class="weui-form-preview__value">{{data.endTime}}</span>
					</div>
					<div class="weui-form-preview__item">
						<label class="weui-form-preview__label">请假理由</label>
						<span class="weui-form-preview__value">{{data.reason}}</span>
					</div>
					<div class="weui-form-preview__item">
						<label class="weui-form-preview__label">申请人</label>
						<span class="weui-form-preview__value">{{data.whoApply}}</span>
					</div>
				</div>
				<div>
					<img @click="previewImage(data.imageUrl)" :src="data.imageUrl" v-if="data.imageUrl"  width="90%">
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	import wx from "weixin-js-sdk";
	export default {
		data() {
			return {
				data: {},
			}
		},
		methods: {
      getWxConfig() {
        let url = window.location.href;
        let _this = this;
        _this.$http.fetchWxConfig({
          url: url
        }).then(resp => {
          wx.config({
            // debug: true,
            appId: resp.data.appId,
            timestamp: resp.data.timestamp, // 必填，生成签名的时间戳
            nonceStr: resp.data.noncestr, // 必填，生成签名的随机串
            signature: resp.data.sign, // 必填，签名
            jsApiList: ['previewImage'] // 必填，需要使用的JS接口列表
          });
        })
      },
			previewImage(url) {
				wx.previewImage({
					previewImage: url,
					urls: [url]
				})
			},
		},
		created() {
			this.data = this.$route.query;
		},
    mounted() {
		  this.getWxConfig();
    }
  }
</script>

<style scoped>
	.details-title {
		font-size: 1.8rem;
		width: 100%;
		padding: 0.5rem 0;
		background: #F7F7F7;
	}
</style>
